using System;
using System.Collections.Generic;
using System.Text;

namespace Numerics
{
    public class Numerics
    {

        public Dictionary<string,double> SecantMethod(double fx1,double x1, double fx2, double x2)
        {
            double x3 = x2 - (fx2 * (x1 - x2) / (fx1 - fx2));
            double e = Math.Abs(x2 - x3);

            Dictionary<string, double> results = new Dictionary<string, double>();
            results["x2"] = x3;
            results["x1"] = x2;
            results["error"] = e;

            return results;
           
        }

        public Dictionary<string, double> ModifiedSecantMethod(double fx, double x, double fxdel, double delta)
        {
            double x2 = x - ((delta * x * fx) / (fxdel - fx));
            double e = Math.Abs(x - x2);

            Dictionary<string, double> results = new Dictionary<string, double>();
            results["x"] = x2;
            results["error"] = e;
            results["delta"] = delta;

            return results;

        }

    }
}
